//Mon May 24 19:47:10 CDT 2010
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class SumRectangle
{
public:
	int getCorner(vector<int> leftColumn, vector<int> topRow)
	{
		int M = leftColumn.size();
		int N = topRow.size();
		vector<vector<int> > v(M, vector<int> (N, 0));
		for (int i = 0; i < M; i++)
		{
			v[i][0] = leftColumn[i];
		}
		for (int i = 0; i < N; i++)
		{
			v[0][i] = topRow[i];
		}
		for (int i = 1; i < M; i++)
		{
			for (int j = 1; j < N; j++)
			{
				v[i][j] = v[i - 1][j - 1] - v[i - 1][j] - v[i][j - 1];
			}
		}
		return v[M-1][N-1];
	}
};
